package com.dingwei.lesyndrome.ui.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.EditText;

import com.allen.library.SuperButton;
import com.dingwei.lesyndrome.R;
import com.dingwei.lesyndrome.mvp.presenter.ModifyPasswordPresenter;
import com.dingwei.lesyndrome.mvp.view.Contract;
import com.lihao.baselibrary.base.BaseActivity;
import com.lihao.baselibrary.utils.AppManager;
import com.lihao.baselibrary.utils.L;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created time 2018/2/26.
 * Creator 南柯一梦丶 on
 * Personal signature 余生还长 何必慌张
 * Page description : 修改密码
 */

public class ModifyPasswordActivity extends BaseActivity implements Contract.ModifyPasswordView {
    ModifyPasswordPresenter modifyPasswordPresenter = new ModifyPasswordPresenter(this);
    @Bind(R.id.et_password)
    EditText etPassword;
    @Bind(R.id.et_new_password)
    EditText etNewPassword;
    @Bind(R.id.et_confirm_new_password)
    EditText etConfirmNewPassword;
    @Bind(R.id.btn_submit)
    SuperButton btnSubmit;

    @Override
    protected int getContentViewId() {
        return R.layout.activity_modify_password;
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initView() {


    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick(R.id.btn_submit)
    public void onViewClicked() {
        modifyPasswordPresenter.modifyPassword(etPassword.getText().toString(),etNewPassword.getText().toString(),etConfirmNewPassword.getText().toString());
    }

    @Override
    public void modifySuccess() {
        BaseActivity.value.setIsLogin(false);
        BaseActivity.value.setToken("");
        BaseActivity.value.setHeadImg("");
        BaseActivity.value.setUserName("");
        BaseActivity.value.setPhone("");

        intent = new Intent();
        setResult(Activity.RESULT_OK, intent);
        finish();

    }
}
